const http = require('http')
const { sleep } = require('./tools')

const app = http.createServer((req, res) => {
	res.writeHead(200, { 'content-type': 'text/html' })
	res.write('loading <br />')
	return sleep(2e3).then(() => {
		res.write('timer: 2000ms<br>')
		return sleep(5e3)
	}).then(function() {
    res.write(`timer: 5000ms<br>`)
  }).then(function() {
    res.end()
  })
})

app.listen(3001)